/// 钱包应用常量定义
class WalletConstants {
  // 应用信息
  static const String appName = 'MyWallet';
  static const String appVersion = '1.0.0';
  
  // 支持的区块链网络
  static const Map<String, NetworkConfig> supportedNetworks = {
    'ethereum': NetworkConfig(
      name: 'Ethereum',
      chainId: 1,
      rpcUrl: 'https://eth.llamarpc.com', // LlamaNodes 公共节点，限制较宽松
      explorerUrl: 'https://etherscan.io',
      symbol: 'ETH',
      decimals: 18,
    ),
        'bsc': NetworkConfig(
          name: 'BSC',
          chainId: 56,
          rpcUrl: 'https://bsc-dataseed.bnbchain.org',
          explorerUrl: 'https://bscscan.com',
          symbol: 'BNB',
          decimals: 18,
        ),
    'polygon': NetworkConfig(
      name: 'Polygon',
      chainId: 137,
      rpcUrl: 'https://polygon.publicnode.com',
      explorerUrl: 'https://polygonscan.com',
      symbol: 'MATIC',
      decimals: 18,
    ),
    'arbitrum': NetworkConfig(
      name: 'Arbitrum',
      chainId: 42161,
      rpcUrl: 'https://arbitrum.publicnode.com',
      explorerUrl: 'https://arbiscan.io',
      symbol: 'ETH',
      decimals: 18,
    ),
  };
  
  // 默认代币
  static const Map<String, TokenConfig> defaultTokens = {
    'ETH': TokenConfig(
      symbol: 'ETH',
      name: 'Ethereum',
      decimals: 18,
      contractAddress: null, // 原生代币
    ),
    'USDT': TokenConfig(
      symbol: 'USDT',
      name: 'Tether USD',
      decimals: 6,
      contractAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    ),
    'USDC': TokenConfig(
      symbol: 'USDC',
      name: 'USD Coin',
      decimals: 6,
      contractAddress: '0xA0b86a33E6441b8c4C8C0d4B0c4C0c4C0c4C0c4C',
    ),
  };
  
  // 安全相关
  static const int minPasswordLength = 8;
  static const int maxLoginAttempts = 5;
  static const Duration lockoutDuration = Duration(minutes: 15);
  
  // UI 相关
  static const double defaultPadding = 16.0;
  static const double defaultRadius = 12.0;
  static const Duration animationDuration = Duration(milliseconds: 300);
  
  // 存储键
  static const String keyWalletData = 'wallet_data';
  static const String keyUserSettings = 'user_settings';
  static const String keyBiometricEnabled = 'biometric_enabled';
  static const String keyCurrentNetwork = 'current_network';
  static const String keyTransactionHistory = 'transaction_history';
}

/// 网络配置
class NetworkConfig {
  final String name;
  final int chainId;
  final String rpcUrl;
  final String explorerUrl;
  final String symbol;
  final int decimals;
  
  const NetworkConfig({
    required this.name,
    required this.chainId,
    required this.rpcUrl,
    required this.explorerUrl,
    required this.symbol,
    required this.decimals,
  });
}

/// 代币配置
class TokenConfig {
  final String symbol;
  final String name;
  final int decimals;
  final String? contractAddress;
  
  const TokenConfig({
    required this.symbol,
    required this.name,
    required this.decimals,
    this.contractAddress,
  });
}
